package com.zhongen.oa.controller;

import com.zhongen.common.core.util.R;
import com.zhongen.oa.service.DingTalkService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/dingTalk")
@Tag(description = "钉钉", name = "钉钉")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class DingTalkController {

	@Resource
	private DingTalkService dingTalkService;

	/**
	 * 同步部门列表 同步部门下的所有人员
	 * @return
	 */
	@GetMapping("/getDeptAndUserFromDingTalk")
	@Operation(summary = "同步组织架构数据")
	public R<Boolean> getDeptAndUserFromDingTalk() {
		dingTalkService.getDeptAndUserFromDingTalk();
		return R.ok(true);
	}

}
